﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ComForm
{
    public delegate bool CheckTakenAwayDelegate();
    public partial class FormIDCardRepeatedWarning : Form
    {
        public CheckTakenAwayDelegate CheckHandler = null;
        
        public FormIDCardRepeatedWarning()
        {
            InitializeComponent();
        }

        private void buttonOK_Click(object sender, EventArgs e)
        {
            timer1.Enabled = false;
            this.Close();
        }

        private void FormIDCardRepeatedWarning_Load(object sender, EventArgs e)
        {
            timer1.Enabled = true;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (CheckHandler != null)
            {
                if (CheckHandler())
                {
                    timer1.Enabled = false;
                    this.Close();
                }
            }
        }
    }
}
